package com.atguigu.bigdata.spark.core.rdd.operator.action

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
  * create by undeRdoG on  2021-06-13  14:21
  * 凡心所向，素履以往，生如逆旅，一苇以航。
  */
object Spark05_RDD_Operation_Action {

  def main(args: Array[String]): Unit = {

    val sparkConf = new SparkConf().setAppName("Operator").setMaster("local[*]")
    val sc = new SparkContext(sparkConf)

    //  TODO 行动算子
    val rdd: RDD[(String, Int)] = sc.makeRDD(List(("a", 1), ("a", 1), ("a", 1), ("b", 1)))


    rdd.saveAsTextFile("TextOutPut")

    rdd.saveAsObjectFile("ObjectOutPut")


    /**
      * saveAsSequenceFile   要求数据的类型必须是键值类型
      **/
    rdd.saveAsSequenceFile("SequenceOutPut")

  }
}
